package org.openclinic.repository;

import java.util.List;

import org.openclinic.domain.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface CustomerRepository extends JpaRepository<Customer, Long> {
	
	@Query("FROM Customer WHERE bond = 1 ORDER BY name")
	List<Customer> findAllCustomers();

	@Query("FROM Customer WHERE UPPER(name) LIKE ?1 ORDER BY name, birthdate")
	List<Customer> searchCustomers(String term);
}
